home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_8 / issue_06 / risc_os / Wimp / Install < prev    next >
Encoding:
Text File  |  1988-12-06  |  5.5 KB  |  145 lines

  1. > Wimp.Install
  2.  
  3. New Calls
  4. ---------
  5.  
  6.         *Obey
  7.         *WimpSlot
  8.  
  9.  
  10. Installation of applications
  11. ----------------------------
  12.  
  13. One of the most annoying problems associated with using application software
  14. on floppy disc is that it can be extremely inconvenient, if not impossible,
  15. to transfer the software onto a hard disc, without rewriting the boot code.
  16.  
  17. With regard to this problem, it is extremely useful if application software
  18. can find out where its resource files are, without having to have the
  19. directory names 'hard-wired' in, and without having to rely on the position
  20. of the 'current directory'.
  21.  
  22. The best way to achieve this is to put all the application software and
  23. associated data files into a single directory, including one file which is
  24. used to start the whole thing up.  When this file is run, it finds out where
  25. it has been run from, and the application continues by assuming that the rest
  26. of the files are contained within the same directory as the initial file.  In
  27. this way the whole application can be installed onto a hard disc (or network,
  28. or whatever) simply by copying the entire directory across.
  29.  
  30. Several features have been further built into Arthur 2.00 to make this
  31. approach work:
  32.  
  33.      *  *Run <directory> attempts to run <directory>.!Run
  34.      *  the *Obey command allows easy access to the path name
  35.         the environment variable <Obey$Dir> is set to the parent dirname
  36.      *  the *WimpSlot command allows application memory to be manipulated
  37.      *  the path name can be held in an environment variable for later use
  38.      *  the Finder recognises directory-names starting with "-":
  39.         - double-clicking on the directory causes it to be *Run
  40.           this actually runs <Directory>.!Run
  41.         - <Directory>.!Boot is run when the parent dir is displayed
  42.           (this helps with setting up datafile filetypes)
  43.         - the boot file can cause a sprite file to be loaded (*IconSprites)
  44.           the dir is displayed as a sprite if one of that name exists
  45.  
  46. By creating a !Run file with a filetype of &FEB (Obey) it is possible to
  47. automatically invoke the application by double-clicking on its directory
  48. icon, and for the Obey command file to do some of the donkey-work involved in
  49. setting-up the environment for later.
  50.  
  51.  
  52. *Obey (see also Wimp.Obey)
  53. -----
  54.  
  55. Syntax:  *Obey <filename> [<parameters>]
  56.  
  57. The file contains text, where each line is a command to be sent to OS_CLI,
  58. optionally containing references to the <parameters> given to *Obey (%0 to %9
  59. reference the parameters, as in an alias.  To reference %0 to %9 literally,
  60. use %%0 to %%9).
  61.  
  62. The *Obey command copies the name of the file's parent directory into the
  63. variable Obey$Dir - if the application wishes to remember this value for
  64. later use, it should use a command of the form:
  65.  
  66.         *Set foo$dir <Obey$Dir>
  67.  
  68. The parent directory is found by stripping '.<leafname>' from the end of the
  69. filename given to *Obey, which may contain an element from Run$Path combined
  70. with the name specified in the original command.  For example,
  71.  
  72.         *Set Run$Path adfs::Winnie.Deskworld.-
  73.         *foo xyz
  74.  
  75. would produce the equivalent of:
  76.  
  77.         *Run adfs::Winnie.Deskworld.-foo xyz
  78.  
  79. which (if -foo.!Run has filetype &FEB) would produce the equivalent of:
  80.  
  81.         *Obey adfs::Winnie.Deskworld.-foo.!Run xyz
  82.  
  83. The latter conversion is achieved by a combination of the FileSwitch
  84. treatment of !Run files, and the setting-up of the filetype &FEB as follows:
  85.  
  86.         *Set Alias$@RunType_FEB Obey %*0
  87.         *Set File$Type_FEB Obey
  88.  
  89.  
  90. *WimpSlot
  91. ---------
  92.  
  93. Syntax:  *WimpSlot [-min] <number>[K] [[-max] <number>[K]]
  94.  
  95. If 'K' (or 'k') follows the <number>, the value is multiplied by 1024. 
  96. <number> can be specified in decimal or &hex, or <base>_<digits>
  97.  
  98. The WimpSlot command calls Wimp_SlotSize as appropriate to ensure that the
  99. right amount of memory is available.  If sufficient memory is not available,
  100. the error 'Not enough application memory' is returned.
  101.  
  102. Since high-level language libraries often respond by crashing completely when
  103. confronted with insufficient application memory, it is wise for applications
  104. to safeguard themselves from such an eventuality by checking that sufficient
  105. memory is available before running the main program.
  106.  
  107.  
  108. Summary
  109. -------
  110.  
  111. In summary, an application directory should contain the following files:
  112.  
  113.         $.-foo                  ; directory name (ie. application)
  114.         $.-foo.!Boot            ; executed by Finder when $ is catalogued
  115.         $.-foo.!Run             ; executed by Finder when -foo is 2-clicked
  116.         $.-foo.<something>      ; specified in !Run file after '-runfile'
  117.  
  118. An example !Boot obey file would look something like this:
  119.  
  120.         | > adfs::foodisc.-foo.!Boot
  121.         |
  122.         IconSprites <Obey$Dir>.!Sprites    (contains icon '-foo')
  123.         Set Alias$@RunType_ddd /<Obey$Dir> %%*0
  124.  
  125. where 'ddd' is the filetype of the data files processed by -foo.  Note the
  126. '%%*0' on the last line: this is necessary because of the parameter
  127. substitution performed by the *obey command.
  128.  
  129. An example !Run obey file would look something like this:
  130.  
  131.         | > adfs::foodisc.-foo.!Run
  132.         |
  133.         | The comment lines are useful for reading later
  134.  
  135.         Set foo$dir <Obey$Dir>
  136.         WimpSlot -min 200k -max 1000k
  137.         Run "<foo$dir>.fooimage" %*0
  138.  
  139. Note the quotes around the filename, which are needed if <foo$dir>.fooimage
  140. is a C program (the C library stuff reads the command line, and would
  141. otherwise think that the '<' denotes redirection), and the '%*0' at the end,
  142. which ensures that the parameters given to the *Obey command originally are
  143. passed through to the main application.
  144.  
  145.